/* 
 * File:   Project.cpp
 * Author: k0l0b0k
 * 
 * Created on 8 Октябрь 2009 г., 13:22
 */

#include <QFile>
#include "Project.h"
#include "SourceFile.h"
#include "Namespace.h"

Project::Project(ProjectOptions* pOpts)
	: mOptions(pOpts)
{
}

Project::~Project()
{
}

bool Project::Parse()
{
	foreach (QString filename, mOptions->SourceFiles)
	{
		SourceFile* sf = new SourceFile(this, filename);
		if (!sf->Parse()) return false;
		mSourceFiles[filename] = sf;
	}
	return true;
}

Namespace* Project::GetOrCreateNamespace(QString pName)
{
	Namespace* ns = mNamespaces[pName];
	if (!ns)
	{
		ns = new Namespace(this, pName);
		mNamespaces[pName] = ns;
	}
	return ns;
}
